#include "main.h"

#define	WAV_BUF_SIZE	36 * 1024

typedef struct AUDIO_DEV {

	size_t		bytesRead;
	uint16_t	play_size;

	uint32_t	fileSize;
	uint32_t	headerSizeLeft;
	uint16_t	compression;
	uint16_t	channelsNum;
	uint32_t	sampleRate;
	uint32_t	bytesPerSecond;
	uint16_t	bytesPerSample;
	uint16_t	bitsPerSamplePerChannel;
	uint32_t	dataSize;

	uint16_t	totalsec;
	
	uint16_t	*buff_A;
	uint16_t	*buff_B;

	uint16_t 	*play_buff;
	uint16_t 	*read_buff;
	uint16_t 	*exchange;

	void (* process_buffer)(void);

} AUDIO_DEV;

extern AUDIO_DEV	*pAudio;

extern int8_t 		*buffPointer;

extern int			Is_finished;
extern int			Is_End_chunk;
extern int			Is_Process_buffer;

extern uint8_t		Is_Busy;


void audio_Start(void);

void audio_Pause(void);

void audio_Resume(void);

void audio_Stop(void);

void audio_Abort(void);

void audio_Transfer(uint16_t *pData, uint16_t Size);

// void F4_I2S_Transmit_DMA(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size);

// void H7_I2S_Transmit_DMA(I2S_HandleTypeDef *hi2s, const uint16_t *pData, uint16_t Size);


